A common problem in forming computer-generated images is aliasing, which is the under-sampling of a signal (or graphic feature) resulting in degraded image quality. For example, geometric aliasing causes a stair-stepping effect (or “jaggies”) to appear on the geometric edges of primitives (or geometries). Non-geometric aliasing is another type of aliasing that is due primarily to under-sampling of texture, for example, or depth. Texture aliasing arises during the sampling of textures when screen coordinates of image pixels can irregularly map to more or fewer texture coordinates of texture pixels (i.e., “texels”). One general anti-aliasing approach is the technique of supersampling an entire frame. While providing higher resolutions with which to reduce aliasing, the conventional technique of supersampling has a drawback of increasing the computational overhead of rendering computer-generated images by a multiplicative amount. For example, a four-times (i.e., “4×”) supersampling technique samples the texture (or shading) of each pixel of a frame four times. Unfortunately, this tends to decrease the frame rate of rendering computer-generated images, especially in shader limited and texture limited situations, to approximately a quarter of the frame rates achieved by other anti-aliasing techniques, such as multisampling. The reduction in frame rate is undesirable for real-time applications. The terms “texture limited” and “shader limited” refer generally to the fastest speed at which a graphics generating system can operate when respectively processing large textures and complicated shading that bottleneck the system.
FIG. 1 shows sampling of a pixel in accordance with multisampling as another conventional anti-aliasing technique. Multisampling reduces stair-casing effects by oversampling a pixel 100 to form four subpixels 102a to 102d. In turn, subpixels 102a to 102d respectively include coverage sample positions 104a to 104d, each of which are used to oversample, for example, geometric edges of geometries covering pixel 100. FIG. 1 identifies each of those coverage sample positions by an “X.” While multisampling reduces geometric aliasing, it has a drawback of sampling shading at only one sample position—at pixel center 106. FIG. 1 identifies the shading sample position by a circle, or “◯.” Notably, multisampling samples the shading at pixel center 106 and then applies the shading to any subpixel of a geometry that covers pixel center 106. But with only one sample position to sample shading, multisampling does not suitably handle oversampling of non-geometric edges, examples of which arise during alpha-tested rendering when using a texture map to add texture to objects and their edges, as well as during the rendering of tight specular exponents (e.g., rendering flashes of light that reflects from a geometric surface).
FIGS. 2 to 4D are diagrams conveying another conventional anti-aliasing technique that repeatedly shifts geometries to new locations. Generally, this technique anti-aliases images by first generating a scene 202 and then repeatedly shifting each pixel of either scene 202 by an amount no greater than a size of a pixel. Each shift offsets or “jitters” an object and its scene so that its geometries shift relative to a number of sample positions that determines coverage and shading for each subpixel. “Jitter” is an amount of shifting that determines the subpixel locations (X,Y) of the samples for each shifted scene. As an example, consider that this technique adds jitter to anti-alias object 220. First, object 220 and its scene are shifted by an amount (e.g., dX=−0.25 pixels, dY=+0.25 pixels) to form shifted scene 204, with shifted scenes 206, 208 and 210 being formed in a similar manner. Combiner 212 receives sampled subpixels from each shifted scene and accumulates them to form a final image. One example of combiner 212 is an accumulation buffer.
FIGS. 3 and 4A to 4D illustrate further the implementation of the conventional jitter-based anti-aliasing technique set forth in FIG. 2. FIG. 3 shows a quad 300 of four pixels 301. Each pixel 301 includes coverage sample positions 302 and shading sample positions 304 for multisampling each pixel in this example. By adding jitter, this technique samples shading for each subpixel 303. Object 310 can represent, for example, a twig in a foreground layer for rendering quad 300. By adding jitter (i.e., ±dX, ±dY), a center point 312 of object 310 shifts to four different positions, each of which are shown in FIGS. 4A to 4D. By shifting object 310 (FIG. 3) over different, stationary shading sample positions 304 four times, the shading for object 310 is sampled four times, thereby providing for 4× non-geometric anti-aliasing.
FIG. 4A illustrates a shifted geometry 402a as a portion of a triangle being shifted from center point 312 by an amount +dX,−dY. Object 410, which is a textured object, shifts from original position 310 to a shifted position within shifted geometry 402a during a first pass. According to this approach, multisampling is used to sample shading at each pixel center 404. A multisample mask is used to select which subpixels will be sampled. In the case shown in FIG. 4A, a multisample mask bit (e.g., bit zero) enables sampling of subpixels 450 at each top left subpixel in quad 400 into an accumulation buffer. In each subsequent pass, as shown in FIGS. 4B, 4C and 4D, this technique shifts center point 312 and object 410 by −dX,+dY, +dX,+dY, and −dX,+dY, respectively, to situate geometry 402a to other shifted positions, such as shifted geometries 402b, 402c and 402d. Other multisample mask bits (e.g., bits 1, 2, and 3) facilitate discrete sampling of corresponding subpixels 452, 454 and 456 in respective passes 2, 3 and 4. After each successive pass, sampled pixels are generally accumulated in an accumulation buffer to form a final image.
There are several drawbacks to the jitter-based anti-aliasing technique described in FIGS. 2 to 4D. First, any shading sample position at each pixel center that is not covered by shifted geometry 402a through 402d can introduce artifacts at the edges of the shifted geometry. Encircled shading sample positions 420 depict uncovered shading sample positions likely to hinder the effectiveness of anti-aliasing by sampling shading for object 410 at locations that are outside the boundaries of shifted geometry 402a. Another drawback is that coverage sample positions 302 (i.e., identified by “X”) do not coincide with shading sample positions 304. This hinders accurate interpolation between screen and texture coordinates and gives rise to some undesirable level of detail (“LOD”) artifacts. Yet another drawback is that each time shifted geometry 402a is shifted to other positions, corresponding depth values usually vary or change at each shading sample position 304 during each shift. Depth values (or Z values) describe the relative distance between a nearest surface of a computer-generated object and a plane, such as a display screen or a view point. Reconciling these different depth values adds complexity to implementing this anti-aliasing approach, for example, during multipass rendering to composite lighting from a number of sources.
Multipass rendering is a well-known technique for forming final images by rendering some or all of the objects in the scene multiple times whereby one or more of those objects are modified during each pass. A desirable implementation of multipass rendering is to supersample both coverage and texture for each pixel of a particular object during a first multipass-rendering pass, and then to sequentially add or composite lighting effects from different lighting sources in subsequent multipass-rendering passes. The use of multisampling to incrementally add lighting during subsequent passes is desirable since multisampling consumes less computational resources than does a supersampling technique that samples both shading and coverage at each coverage sample position 302. But a drawback to using multisampling in conjunction with jitter-based supersampling is that different depth values are determined for a geometry being shifted over each sample position during the jitter-based supersampling. As such, subsequent multisampling passes to apply lighting to that geometry requires computation-intensive interpolations to match the different depth values. Consequently, correcting mismatched depth values (or Z values) due to shifting object 410 generally offsets the benefits of using such an approach in graphics pipelines.
FIGS. 5A to 5D illustrate various arrangements of sample positions 502 that are positioned differently in each arrangement, which yields yet still another drawback. These coverage sample positions 502 are not moveable and these arrangements are usually hardware-specific. A user therefore requires specialized knowledge to determine sample positions 502 to use the conventional anti-aliasing technique described in FIGS. 2 to 4D, especially when implementing an accumulation buffer to oversample and/or to perform multipass rendering of an object within a scene. This is because a user generally must know the locations of those sample positions 502 when applying jitter-based supersampling to anti-alias an object.
FIGS. 6A and 6B demonstrate limitations of centroid multisampling, which has been recently developed to address some deficiencies associated with multisampling. In particular, centroid sampling adjusts the position for determining geometry color to be the center of all the covered sample positions of an entire pixel. For example, FIGS. 6A and 6B both show a shading sample position 614 for an unshifted geometry 602 (shown in dashed lines). But when the jitter-based anti-aliasing approach is active, then unshifted geometry 602 shifts to a position occupied by shifted geometry 604 of FIG. 6A for a first sample and by shifted geometry 606 of FIG. 6B for a second sample. A drawback to this approach is that the shifted geometry causes the centroid to change, thereby establishing unpredictable shading sample locations. For example, consider that the geometry shifts to a position occupied by shifted geometry 604 in FIG. 6A such that the geometry covers coverage sample position 612 but does not cover coverage sample position 616. Conventional centroid multisampling would then set a centroid sample 618 (shown as a solid square) to coincide with coverage sample position 612. So the net effect of shifting the geometry is FIG. 6A is −dX, +dY, as defined by the jitter-based anti-aliasing approach. But if the same geometry shifts to a position occupied by shifted geometry 606 in FIG. 6B so that both coverage sample positions 612 and 616 are covered, then centroid sample 618 (shown as a solid square) would be set between those coverage sample positions. Consequently, the shading sampling position would not shift by a predictable amount as does the geometry. That is, if the geometry shifts by +dX, +dY from shading sample position 614, then conventional centroid sampling causes the shading sample to reduce the actual amount of the shift by locating the shading sample at centroid sample 618. As shown in FIG. 6B, this results in an effective net shift of 0, +dY for the geometry (i.e., the geometry shifts by +dX and centroid multisampling resets the centroid sample back by −dX to between converge sample positions 612 and 616). So with the effective net shift of the geometries being made unpredictable, a jitter-based anti-aliasing approach implementing conventional centroid multisampling will be subject to significant reductions in quality improvement.
In view of the foregoing, it would be desirable to provide a system, an apparatus and a method for minimizing the drawbacks of the above-described conventional anti-aliasing techniques.